﻿$("form").submit(function () {
    var selectedDishCategories = $("input[class*='custom']:checked");
    if (selectedDishCategories.length > 0) {
        selectedDishCategories.each(function (i) {
            $(this).attr("name", "DishTemplates[" + i + "].Category.Id");
            var text = $("[class*='range'][id=" + $(this).attr("id") + "]:input");
            text.attr("name", "DishTemplates[" + i + "].DishSum");
        });
    }
});